/**
 * @(#)AppWin.java 2011-11-5 Copyright 2011 it.kedacom.com, Inc. All rights
 *                 reserved.
 */

package com.kedacom.xmpp.demo.gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import net.miginfocom.swing.MigLayout;

/**
 * (用一句话描述类的主要功能)
 * @author xiaojinghai
 * @date 2011-11-5
 */

public class AppWin {

	private JFrame frame;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {

			public void run() {
				try {

					LoginDialog loginDialog = new LoginDialog();
					loginDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
					loginDialog.setVisible(true);
					boolean login = loginDialog.hasLogined();
					if (login) {
						AppWin window = new AppWin();
						window.frame.setVisible(true);
					} else {
						System.exit(0);
					}
					System.out.println(login);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public AppWin() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 504, 413);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(new BorderLayout(0, 0));

		JPanel panel = new JPanel();
		frame.getContentPane().add(panel, BorderLayout.NORTH);
		panel.setLayout(new MigLayout("", "[]", "[]"));

		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
	}
}
